﻿using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web.Services;
using BluePortal.Medias.Core;

namespace BluePortal.QuikStart.WSAjax
{
    [WebService(Namespace = "BluePortal.QuikStart.WSAjax")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WSTags : System.Web.Services.WebService
    {
        [WebMethod]
        public string[] GetTagsBeginWith(string prefixText, int count)
        {
            BCTag bctag = new BCTag();
            IEnumerable<Tag> query = bctag.FindStartWith(prefixText);

            List<string> res = new List<string>();
            foreach (Tag t in query.Take(count))
                res.Add(t.TagName);
            return res.ToArray();
        }
    }

}